#!/bin/bash -eu

mydir=$(
    cd "$(dirname "$0")"
    pwd
)

cat "$mydir"/t/test_*.py |
    tr -d '\n' |
    grep -Eo '@pytest.mark.complete\(([^)]*\<require_(cmd|longopt) *= *True\>[^)]*)\)' |
    sed -ne 's/^[^"]*"\\\?\([^_][^[:space:]"]*\)[[:space:]"].*/\1/p' |
    LC_ALL=C sort -u \
        >"$mydir"/test-cmd-list.txt
